"""
@Project ：Python_Learning 
@File    ：6.数组.py
@IDE     ：PyCharm 
@Author  ：zhupp
@Date    ：2024/10/5 15:23 
"""


# import array
#
# a = array.array('i')
# for i in range(10):
#     a.append(i)
#
# print(a)
# a.append(1)
# print(a)\


class A:

    def __init__(self, list_a):
        self.list_a = list_a
        self.index = 0

    def __iter__(self):
        return self

    def __next__(self):
        if self.index >= len(self.list_a):
            raise StopIteration
        value = self.list_a[self.index]
        self.index += 1
        return value


a = A([1, 2, 3])

for i in a:
   print(i)